home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------
- * *
- * Copyright (C) 1991, 1992, 1993, 1994, Silicon Graphics, Inc. *
- * All Rights Reserved. *
- * *
- * The files in this subtree contain UNPUBLISHED PROPRIETARY SOURCE *
- * CODE of Silicon Graphics, Inc.; the contents of these files may *
- * not be disclosed to third parties, copied or duplicated in any *
- * form, in whole or in part, without the prior written permission *
- * of Silicon Graphics, Inc. *
- * *
- * RESTRICTED RIGHTS LEGEND: *
- * Use, duplication or disclosure by the Government is subject to *
- * restrictions as set forth in subdivision (c)(1)(ii) of the Rights in *
- * Technical Data and Computer Software clause at DFARS 252.227-7013, *
- * and/or in similar or successor clauses in the FAR, DOD or NASA FAR *
- * Supplement. Unpublished - rights reserved under the Copyright Laws *
- * of the United States. *
- * *
- * THIS SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, *
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY *
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. *
- * *
- * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, *
- * INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY *
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, *
- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY *
- * THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR *
- * PERFORMANCE OF THIS SOFTWARE. *
- **************************************************************************
- *
- * This file contains a new version of XtAppInitialize. It performs all
- * the same functions except allows the user to create their own icon
- * window at the appropriate time.
- *------------------------------------------------------------------------*/
-
- #include <stdio.h>
-
- #include "Initialize.h"
-
- #include <X11/StringDefs.h>
- #include <X11/Shell.h>
-
- /*------------------------------------------------------------------------
- * Function Name: XtAppInitializeWithIcon
- * Description: Identical to XtAppInitialize except allows the
- * application to generate an icon window at the
- * appropriate time.
- * Arguments: app_context_return The application context
- * of the application.
- * app_class The class of the application
- * options The option list.
- * num_options The number of options.
- * argc_in_out 'argc' from main routine
- * argv_in_out 'argv' from main routine
- * fallback_resources List of fallback resources
- * args, num_args Arguments to use when
- * creating the shell widget.
- * makeIcon Pointer to the function
- * to call when the icon is
- * to be made.
- * Returns: The shell widget.
- *------------------------------------------------------------------------*/
-
- Widget XtAppInitializeWithIcon (XtAppContext* app_context_return,
- String app_class,
- XrmOptionDescRec* options,
- Cardinal num_options,
- #if XtSpecificationRelease > 4
- int* argc_in_out,
- #else
- Cardinal* argc_in_out,
- #endif
- String* argv_in_out,
- String* fallback_resources,
- ArgList args_in,
- Cardinal num_args,
- makeIcon doIcon)
- {
- XtAppContext app_con;
- Display* dpy;
- String* saved_argv;
- int i, saved_argc = *argc_in_out;
- Widget root;
- Arg args[4], *merged_args;
- Cardinal num = 0;
- Window icon;
-
- XtToolkitInitialize ();
-
- /*----
- * Save away argv so we can set the properties later.
- *----*/
-
- saved_argv = (String *) XtMalloc ((*argc_in_out + 1) * sizeof (String));
- for (i = 0; i < saved_argc; i++)
- saved_argv[i] = argv_in_out[i];
- saved_argv[i] = NULL;
-
- app_con = XtCreateApplicationContext ();
-
- if (fallback_resources != NULL)
- XtAppSetFallbackResources (app_con, fallback_resources);
-
- dpy = XtOpenDisplay (app_con, (String)NULL, (String)NULL, app_class,
- options, num_options, argc_in_out, argv_in_out);
-
- if (dpy == NULL)
- XtErrorMsg ("invalidDisplay", "xtInitializeWithIcon",
- "XtInitializeWithIcon", "Can't open display",
- (String *)NULL, (Cardinal *)NULL);
-
- if (doIcon)
- icon = (*doIcon) (dpy, argc_in_out, argv_in_out);
-
- if (icon)
- XtSetArg (args[num], "iconWindow", icon); num++;
- XtSetArg (args[num], XtNscreen, DefaultScreenOfDisplay (dpy)); num++;
- XtSetArg (args[num], XtNargc, saved_argc); num++;
- XtSetArg (args[num], XtNargv, saved_argv); num++;
- merged_args = XtMergeArgLists (args_in, num_args, args, num);
- num += num_args;
-
- root = XtAppCreateShell (NULL, app_class, applicationShellWidgetClass,
- dpy, merged_args, num);
-
- if (app_context_return != NULL)
- *app_context_return = app_con;
-
- XtFree ((XtPointer)merged_args);
- XtFree ((XtPointer)saved_argv);
-
- return root;
- }
-